﻿namespace HRM.CORE
{
    using DevExpress.Utils;
    using DevExpress.XtraBars;
    using DevExpress.XtraBars.Docking;
    using DevExpress.XtraEditors;
    using DevExpress.XtraEditors.Controls;
    using DevExpress.XtraEditors.Repository;
    using DevExpress.XtraGrid;
    using DevExpress.XtraGrid.Menu;
    using DevExpress.XtraGrid.Views.BandedGrid;
    using DevExpress.XtraGrid.Views.Base;
    using DevExpress.XtraGrid.Views.Grid;
    using DevExpress.XtraGrid.Views.Grid.ViewInfo;
    using APP.HELPER;
    using Common.Base;
    using Common.Class; using APP.HELPER.Utils.Language; using Security.Security; using Dictionary.ERP;
    using Common.Report;
    using HRM.CORE;
    using System; using Extra.ERP;
    using System.ComponentModel;
    using System.Drawing;
    using System.Runtime.CompilerServices;
    using System.Windows.Forms; using Common;
    using Security.ERP;
    using Extra.ERP;
    using Common;

    public class xucWelfare : Common.Base.XucBaseBasicB
    {
        private BandedGridColumn colDescription;
        private BandedGridColumn colForm;
        private BandedGridColumn colLocation;
        private BandedGridColumn colMoneyAllCompany;
        private BandedGridColumn colMoneyAllEmployee;
        private BandedGridColumn colMoneyAllTotal;
        private BandedGridColumn colMoneyOneCompany;
        private BandedGridColumn colMoneyOneEmployee;
        private BandedGridColumn colMoneyOneTotal;
        private BandedGridColumn colMoneyTotal;
        private BandedGridColumn colPartnerAddress;
        private BandedGridColumn colPartnerName;
        private BandedGridColumn colPartnerPhone;
        private BandedGridColumn colPerformFromDate;
        private BandedGridColumn colPerformToDate;
        private BandedGridColumn colPrepareFromDate;
        private BandedGridColumn colPrepareToDate;
        private BandedGridColumn colPurpose;
        private BandedGridColumn colQuantity;
        private BandedGridColumn colRegisterFromDate;
        private BandedGridColumn colRegisterToDate;
        private BandedGridColumn colStatus;
        private BandedGridColumn colWelfareCode;
        private BandedGridColumn colWelfareName;
        private IContainer components = null;
        private DockManager dm;
        private AdvBandedGridView gbList;
        private GridControl gcList;
        private GridBand gridBand1;
        private GridBand gridBand2;
        private GridBand gridBand3;
        private GridBand gridBand4;
        private GridBand gridBand5;
        private GridBand gridBand6;
        private GridBand gridBand7;
        private GridBand gridBand8;
        private PanelControl panelControl1;
        private RepositoryItemCalcEdit repCal;

        public event ItemSelectedEventHander ItemSelected;

        public xucWelfare()
        {
            this.InitializeComponent();
            if (base.ParentForm != null)
            {
                this.dm.Form = base.ParentForm;
            }
            this.Init();
            base.ucToolBar.bm.SetPopupContextMenu(this.gcList, base.ucToolBar.pm);
            base.ucToolBar.bbiHistory.Visibility = BarItemVisibility.Always;
            base.ucToolBar.bbiUtils.Visibility = BarItemVisibility.Always;
            base.ucToolBar.bbiGroup.Visibility = BarItemVisibility.Always;
            base.ucToolBar.bbiMerge.Visibility = BarItemVisibility.Always;
            base.ucToolBar.bbiChangeId.Visibility = BarItemVisibility.Always;
            base.ucToolBar.bbiEditUnitConvret.Visibility = BarItemVisibility.Always;
        }

        protected override void Add()
        {
            xfmWelfareAdd add = new xfmWelfareAdd(Actions.Add);
            add.Added += new xfmWelfareAdd.AddedEventHander(this.frm_Added);
            add.ShowDialog();
        }

        public override void Change()
        {
            if (MyRule.IsAccess("bbiWelfare"))
            {
                HRM_WELFARE item = new HRM_WELFARE();
                object focusedRowCellValue = this.gbList.GetFocusedRowCellValue("WelfareCode");
                if (focusedRowCellValue != null)
                {
                    base.SetWaitDialogCaption("Đang kiểm tra dữ liệu....");
                    if (item.Get(focusedRowCellValue.ToString()) != "OK")
                    {
                        this.DoHide();
                        XtraMessageBox.Show("Dữ liệu kh\x00f4ng tồn tại", "Th\x00f4ng B\x00e1o", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                    else
                    {
                        this.DoHide();
                        xfmWelfareAdd add = new xfmWelfareAdd(Actions.Update, item);
                        add.Updated += new xfmWelfareAdd.UpdatedEventHander(this.frm_Updated);
                        add.Added += new xfmWelfareAdd.AddedEventHander(this.frm_Added);
                        add.ShowDialog();
                    }
                }
            }
        }

        public override void Delete()
        {
            if (MyRule.IsDelete("bbiWelfare"))
            {
                bool flag = false;
                int[] selectedRows = this.gbList.GetSelectedRows();
                if (XtraMessageBox.Show("Bạn c\x00f3 muốn x\x00f3a kh\x00f4ng?", "Th\x00f4ng b\x00e1o", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.No)
                {
                    string str;
                    object rowCellValue;
                    base.SetWaitDialogCaption("Đang x\x00f3a...");
                    HRM_WELFARE hrm_welfare = new HRM_WELFARE();
                    for (int i = selectedRows.Length; i > 0; i--)
                    {
                        flag = true;
                        rowCellValue = this.gbList.GetRowCellValue(selectedRows[i - 1], "WelfareCode");
                        if (rowCellValue != null)
                        {
                            SYS_LOG.Insert("Danh S\x00e1ch Ph\x00f2ng Ban", "Xo\x00e1", rowCellValue.ToString());
                            str = hrm_welfare.Delete(rowCellValue.ToString());
                            if (str == "OK")
                            {
                                this.gbList.DeleteRow(selectedRows[i - 1]);
                            }
                            else if (str != "OK")
                            {
                                MessageBox.Show("Th\x00f4ng tin kh\x00f4ng được x\x00f3a\r\n" + str, "Th\x00f4ng b\x00e1o", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                            }
                        }
                    }
                    this.DoHide();
                    if (!flag && (hrm_welfare.GetList().Rows.Count != 0))
                    {
                        rowCellValue = this.gbList.GetFocusedRowCellValue("WelfareCode");
                        if (rowCellValue != null)
                        {
                            SYS_LOG.Insert("Danh S\x00e1ch Ph\x00f2ng Ban", "Xo\x00e1", rowCellValue.ToString());
                            base.SetWaitDialogCaption("Đang x\x00f3a...");
                            str = hrm_welfare.Delete(rowCellValue.ToString());
                            if (str == "OK")
                            {
                                this.gbList.DeleteRow(this.gbList.FocusedRowHandle);
                            }
                            else if (str != "OK")
                            {
                                MessageBox.Show("Th\x00f4ng tin kh\x00f4ng được x\x00f3a\r\n" + str, "Th\x00f4ng b\x00e1o", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                            }
                            this.DoHide();
                        }
                    }
                }
            }
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing && (this.components != null))
            {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }

        protected void DoShowMenu(GridHitInfo hi)
        {
            if (hi.HitTest == GridHitTest.ColumnButton)
            {
                GridViewMenu menu = new GridViewColumnButtonMenu(this.gbList);
                menu.Init(hi);
                menu.Show(hi.HitPoint);
            }
        }

        protected override bool ExportPermision()
        {
            base._exportView = this.gbList;
            if (!MyRule.IsExport("bbiWelfare"))
            {
                return false;
            }
            SYS_LOG.Insert("Danh S\x00e1ch Ph\x00f2ng Ban", "Xuất");
            return base.ExportPermision();
        }

        private void frm_Added(object sender, HRM_WELFARE Item)
        {
            this.ReLoad();
        }

        private void frm_Updated(object sender, HRM_WELFARE Item)
        {
            this.ReLoad();
        }

        private void gbList_CustomDrawRowIndicator(object sender, RowIndicatorCustomDrawEventArgs e)
        {
            if (e.RowHandle == -2147483648)
            {
                e.Handled = true;
                e.Painter.DrawObject(e.Info);
                Rectangle bounds = e.Bounds;
                e.Graphics.FillRectangle(new SolidBrush(Color.FromArgb(0x3f, 0xa5, 0xa5, 0)), bounds);
                bounds.Height--;
                bounds.Width--;
                e.Graphics.DrawRectangle(Pens.Blue, bounds);
            }
            int rowHandle = e.RowHandle;
            if (rowHandle >= 0)
            {
                rowHandle++;
                e.Info.DisplayText = rowHandle.ToString();
            }
        }

        private void gbList_DoubleClick(object sender, EventArgs e)
        {
            if (this.gbList.RowCount != 0)
            {
                this.Change();
            }
        }

        private void gbList_KeyDown(object sender, KeyEventArgs e)
        {
            this.ucList_ListKeyDown(sender, e);
            if ((e.KeyCode == Keys.Delete) && (this.gbList.RowCount != 0))
            {
                this.Delete();
                this.SetMenu(null);
            }
        }

        private void gbList_MouseDown(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left)
            {
                this.DoShowMenu(this.gbList.CalcHitInfo(new Point(e.X, e.Y)));
            }
            this.SetMenu(null);
        }

        private void gbList_RowCellClick(object sender, RowCellClickEventArgs e)
        {
            Common.Class.RowClickEventArgs ex = new Common.Class.RowClickEventArgs(e.RowHandle, e.Column.ColumnHandle);
            this.ItemSelectd(ex);
            this.SetMenu(ex);
            this.SetSearch(ex);
        }

        private void Init()
        {
            MyRule.Check("bbiWelfare");
            base.ucToolBar.bbiPrint.Visibility = MyRule.Printed;
            base.ucToolBar.bbiExport.Visibility = MyRule.Exported;
            base.ucToolBar.bbiAdd.Visibility = MyRule.Added;
            base.ucToolBar.bbiDelete.Visibility = MyRule.Deleted;
            base.ucToolBar.bbiEdit.Visibility = MyRule.Edited;
            base.RibbonBar.Add.Visibility = MyRule.Added;
            base.RibbonBar.Change.Visibility = MyRule.Edited;
            base.RibbonBar.Delete.Visibility = MyRule.Deleted;
            base.RibbonBar.Print.Visibility = MyRule.Printed;
            base.RibbonBar.Export.Visibility = MyRule.Exported;
            base.RibbonBar.Import.Visibility = MyRule.Imported;
            this.gcList.DataSource = new HRM_WELFARE().GetList();
        }

        private void InitializeComponent()
        {
            this.components = new Container();
            StyleFormatCondition condition = new StyleFormatCondition();
            StyleFormatCondition condition2 = new StyleFormatCondition();
            this.colStatus = new BandedGridColumn();
            this.gcList = new GridControl();
            this.gbList = new AdvBandedGridView();
            this.gridBand1 = new GridBand();
            this.colWelfareCode = new BandedGridColumn();
            this.colWelfareName = new BandedGridColumn();
            this.colPurpose = new BandedGridColumn();
            this.colForm = new BandedGridColumn();
            this.colLocation = new BandedGridColumn();
            this.colDescription = new BandedGridColumn();
            this.gridBand2 = new GridBand();
            this.colPrepareFromDate = new BandedGridColumn();
            this.colPrepareToDate = new BandedGridColumn();
            this.gridBand3 = new GridBand();
            this.colRegisterFromDate = new BandedGridColumn();
            this.colRegisterToDate = new BandedGridColumn();
            this.gridBand4 = new GridBand();
            this.colPerformFromDate = new BandedGridColumn();
            this.colPerformToDate = new BandedGridColumn();
            this.gridBand5 = new GridBand();
            this.colQuantity = new BandedGridColumn();
            this.colMoneyTotal = new BandedGridColumn();
            this.repCal = new RepositoryItemCalcEdit();
            this.gridBand6 = new GridBand();
            this.colMoneyOneEmployee = new BandedGridColumn();
            this.colMoneyOneCompany = new BandedGridColumn();
            this.colMoneyOneTotal = new BandedGridColumn();
            this.gridBand7 = new GridBand();
            this.colMoneyAllEmployee = new BandedGridColumn();
            this.colMoneyAllCompany = new BandedGridColumn();
            this.colMoneyAllTotal = new BandedGridColumn();
            this.gridBand8 = new GridBand();
            this.colPartnerName = new BandedGridColumn();
            this.colPartnerPhone = new BandedGridColumn();
            this.colPartnerAddress = new BandedGridColumn();
            this.dm = new DockManager(this.components);
            this.panelControl1 = new PanelControl();
            this.gcList.BeginInit();
            this.gbList.BeginInit();
            this.repCal.BeginInit();
            this.dm.BeginInit();
            this.panelControl1.BeginInit();
            this.panelControl1.SuspendLayout();
            base.SuspendLayout();
            base.ucToolBar.BorderStyle = BorderStyle.FixedSingle;
            base.ucToolBar.Size = new Size(0x2e8, 0x2d);
            this.colStatus.Caption = "Trạng th\x00e1i";
            this.colStatus.FieldName = "Status";
            this.colStatus.Name = "colStatus";
            this.colStatus.OptionsColumn.AllowEdit = false;
            this.colStatus.OptionsColumn.ReadOnly = true;
            this.gcList.Dock = DockStyle.Fill;
            this.gcList.EmbeddedNavigator.Buttons.Append.Visible = false;
            this.gcList.EmbeddedNavigator.Buttons.CancelEdit.Visible = false;
            this.gcList.EmbeddedNavigator.Buttons.Edit.Visible = false;
            this.gcList.EmbeddedNavigator.Buttons.EndEdit.Visible = false;
            this.gcList.EmbeddedNavigator.Buttons.Remove.Visible = false;
            this.gcList.EmbeddedNavigator.TextStringFormat = "{0}/{1}";
            this.gcList.Location = new Point(0, 1);
            this.gcList.MainView = this.gbList;
            this.gcList.Name = "gcList";
            this.gcList.RepositoryItems.AddRange(new RepositoryItem[] { this.repCal });
            this.gcList.Size = new Size(0x2e8, 0x1d1);
            this.gcList.TabIndex = 2;
            this.gcList.UseEmbeddedNavigator = true;
            this.gcList.ViewCollection.AddRange(new BaseView[] { this.gbList });
            this.gbList.Appearance.GroupRow.Font = new Font("Tahoma", 8.25f, FontStyle.Bold);
            this.gbList.Appearance.GroupRow.Options.UseFont = true;
            this.gbList.Appearance.HeaderPanel.Options.UseFont = true;
            this.gbList.Appearance.HeaderPanel.Options.UseImage = true;
            this.gbList.Appearance.HeaderPanel.Options.UseTextOptions = true;
            this.gbList.Appearance.HeaderPanel.TextOptions.HAlignment = HorzAlignment.Center;
            this.gbList.Appearance.HeaderPanel.TextOptions.WordWrap = WordWrap.Wrap;
            this.gbList.Bands.AddRange(new GridBand[] { this.gridBand1, this.gridBand2, this.gridBand3, this.gridBand4, this.gridBand5, this.gridBand6, this.gridBand7, this.gridBand8 });
            this.gbList.BorderStyle = BorderStyles.NoBorder;
            this.gbList.ColumnPanelRowHeight = 0x24;
            this.gbList.Columns.AddRange(new BandedGridColumn[] { 
                this.colWelfareCode, this.colWelfareName, this.colPurpose, this.colForm, this.colLocation, this.colQuantity, this.colPrepareFromDate, this.colPrepareToDate, this.colRegisterFromDate, this.colRegisterToDate, this.colPerformFromDate, this.colPerformToDate, this.colStatus, this.colMoneyTotal, this.colMoneyOneEmployee, this.colMoneyOneCompany, 
                this.colMoneyOneTotal, this.colMoneyAllEmployee, this.colMoneyAllCompany, this.colMoneyAllTotal, this.colPartnerName, this.colPartnerPhone, this.colPartnerAddress, this.colDescription
             });
            condition.Appearance.ForeColor = Color.Red;
            condition.Appearance.Options.UseForeColor = true;
            condition.ApplyToRow = true;
            condition.Column = this.colStatus;
            condition.Condition = FormatConditionEnum.Equal;
            condition.Value1 = "0";
            condition2.Appearance.ForeColor = Color.Green;
            condition2.Appearance.Options.UseForeColor = true;
            condition2.ApplyToRow = true;
            condition2.Column = this.colStatus;
            condition2.Condition = FormatConditionEnum.Equal;
            condition2.Value1 = "1";
            this.gbList.FormatConditions.AddRange(new StyleFormatCondition[] { condition, condition2 });
            this.gbList.GridControl = this.gcList;
            this.gbList.GroupPanelText = "K\x00e9o v\x00e0 Thả cột v\x00e0o đ\x00e2y để nh\x00f3m dữ liệu";
            this.gbList.IndicatorWidth = 40;
            this.gbList.Name = "gbList";
            this.gbList.OptionsBehavior.AllowIncrementalSearch = true;
            this.gbList.OptionsBehavior.AutoExpandAllGroups = true;
            this.gbList.OptionsBehavior.CopyToClipboardWithColumnHeaders = false;
            this.gbList.OptionsBehavior.FocusLeaveOnTab = true;
            this.gbList.OptionsLayout.StoreAllOptions = true;
            this.gbList.OptionsLayout.StoreAppearance = true;
            this.gbList.OptionsMenu.EnableColumnMenu = false;
            this.gbList.OptionsMenu.EnableGroupPanelMenu = false;
            this.gbList.OptionsNavigation.EnterMoveNextColumn = true;
            this.gbList.OptionsSelection.InvertSelection = true;
            this.gbList.OptionsSelection.MultiSelect = true;
            this.gbList.OptionsView.AnimationType = GridAnimationType.AnimateFocusedItem;
            this.gbList.OptionsView.ShowAutoFilterRow = true;
            this.gbList.OptionsView.ShowGroupPanel = false;
            this.gbList.CustomDrawRowIndicator += new RowIndicatorCustomDrawEventHandler(this.gbList_CustomDrawRowIndicator);
            this.gbList.KeyDown += new KeyEventHandler(this.gbList_KeyDown);
            this.gbList.MouseDown += new MouseEventHandler(this.gbList_MouseDown);
            this.gbList.DoubleClick += new EventHandler(this.gbList_DoubleClick);
            this.gbList.RowCellClick += new RowCellClickEventHandler(this.gbList_RowCellClick);
            this.gridBand1.AppearanceHeader.Options.UseTextOptions = true;
            this.gridBand1.AppearanceHeader.TextOptions.HAlignment = HorzAlignment.Center;
            this.gridBand1.Caption = "Th\x00f4ng tin chương tr\x00ecnh";
            this.gridBand1.Columns.Add(this.colWelfareCode);
            this.gridBand1.Columns.Add(this.colWelfareName);
            this.gridBand1.Columns.Add(this.colPurpose);
            this.gridBand1.Columns.Add(this.colForm);
            this.gridBand1.Columns.Add(this.colLocation);
            this.gridBand1.Columns.Add(this.colDescription);
            this.gridBand1.Columns.Add(this.colStatus);
            this.gridBand1.MinWidth = 20;
            this.gridBand1.Name = "gridBand1";
            this.gridBand1.Width = 0x3b9;
            this.colWelfareCode.Caption = "M\x00e3 chương tr\x00ecnh";
            this.colWelfareCode.FieldName = "WelfareCode";
            this.colWelfareCode.Name = "colWelfareCode";
            this.colWelfareCode.OptionsColumn.AllowEdit = false;
            this.colWelfareCode.OptionsColumn.ReadOnly = true;
            this.colWelfareCode.Visible = true;
            this.colWelfareName.Caption = "T\x00ean chương tr\x00ecnh";
            this.colWelfareName.FieldName = "WelfareName";
            this.colWelfareName.Name = "colWelfareName";
            this.colWelfareName.OptionsColumn.AllowEdit = false;
            this.colWelfareName.OptionsColumn.ReadOnly = true;
            this.colWelfareName.Visible = true;
            this.colWelfareName.Width = 0x9c;
            this.colPurpose.Caption = "Mục đ\x00edch";
            this.colPurpose.FieldName = "Purpose";
            this.colPurpose.Name = "colPurpose";
            this.colPurpose.OptionsColumn.AllowEdit = false;
            this.colPurpose.OptionsColumn.ReadOnly = true;
            this.colPurpose.Visible = true;
            this.colPurpose.Width = 0xa7;
            this.colForm.Caption = "H\x00ecnh thức thực hiện";
            this.colForm.FieldName = "Form";
            this.colForm.Name = "colForm";
            this.colForm.OptionsColumn.AllowEdit = false;
            this.colForm.OptionsColumn.ReadOnly = true;
            this.colForm.Visible = true;
            this.colForm.Width = 0xb1;
            this.colLocation.Caption = "Địa điểm";
            this.colLocation.FieldName = "Location";
            this.colLocation.Name = "colLocation";
            this.colLocation.OptionsColumn.AllowEdit = false;
            this.colLocation.OptionsColumn.ReadOnly = true;
            this.colLocation.Visible = true;
            this.colLocation.Width = 0xa9;
            this.colDescription.Caption = "M\x00f4 tả";
            this.colDescription.FieldName = "Description";
            this.colDescription.Name = "colDescription";
            this.colDescription.OptionsColumn.AllowEdit = false;
            this.colDescription.OptionsColumn.ReadOnly = true;
            this.colDescription.Visible = true;
            this.colDescription.Width = 0xd1;
            this.gridBand2.AppearanceHeader.Options.UseTextOptions = true;
            this.gridBand2.AppearanceHeader.TextOptions.HAlignment = HorzAlignment.Center;
            this.gridBand2.Caption = "Thời gian dự kiến";
            this.gridBand2.Columns.Add(this.colPrepareFromDate);
            this.gridBand2.Columns.Add(this.colPrepareToDate);
            this.gridBand2.MinWidth = 20;
            this.gridBand2.Name = "gridBand2";
            this.gridBand2.Width = 150;
            this.colPrepareFromDate.Caption = "Từ ng\x00e0y";
            this.colPrepareFromDate.FieldName = "PrepareFromDate";
            this.colPrepareFromDate.Name = "colPrepareFromDate";
            this.colPrepareFromDate.Visible = true;
            this.colPrepareToDate.Caption = "Đến ng\x00e0y";
            this.colPrepareToDate.FieldName = "PrepareToDate";
            this.colPrepareToDate.Name = "colPrepareToDate";
            this.colPrepareToDate.Visible = true;
            this.gridBand3.AppearanceHeader.Options.UseTextOptions = true;
            this.gridBand3.AppearanceHeader.TextOptions.HAlignment = HorzAlignment.Center;
            this.gridBand3.Caption = "Thời gian đăng k\x00fd";
            this.gridBand3.Columns.Add(this.colRegisterFromDate);
            this.gridBand3.Columns.Add(this.colRegisterToDate);
            this.gridBand3.MinWidth = 20;
            this.gridBand3.Name = "gridBand3";
            this.gridBand3.Width = 150;
            this.colRegisterFromDate.Caption = "Từ ng\x00e0y";
            this.colRegisterFromDate.FieldName = "RegisterFromDate";
            this.colRegisterFromDate.Name = "colRegisterFromDate";
            this.colRegisterFromDate.Visible = true;
            this.colRegisterToDate.Caption = "Đến ng\x00e0y";
            this.colRegisterToDate.FieldName = "RegisterToDate";
            this.colRegisterToDate.Name = "colRegisterToDate";
            this.colRegisterToDate.Visible = true;
            this.gridBand4.AppearanceHeader.Options.UseTextOptions = true;
            this.gridBand4.AppearanceHeader.TextOptions.HAlignment = HorzAlignment.Center;
            this.gridBand4.Caption = "Thời gian thực hiện";
            this.gridBand4.Columns.Add(this.colPerformFromDate);
            this.gridBand4.Columns.Add(this.colPerformToDate);
            this.gridBand4.MinWidth = 20;
            this.gridBand4.Name = "gridBand4";
            this.gridBand4.Width = 150;
            this.colPerformFromDate.Caption = "Từ ng\x00e0y";
            this.colPerformFromDate.FieldName = "PerformFromDate";
            this.colPerformFromDate.Name = "colPerformFromDate";
            this.colPerformFromDate.Visible = true;
            this.colPerformToDate.Caption = "Đến ng\x00e0y";
            this.colPerformToDate.FieldName = "PerformToDate";
            this.colPerformToDate.Name = "colPerformToDate";
            this.colPerformToDate.Visible = true;
            this.gridBand5.AppearanceHeader.Options.UseTextOptions = true;
            this.gridBand5.AppearanceHeader.TextOptions.HAlignment = HorzAlignment.Center;
            this.gridBand5.AppearanceHeader.TextOptions.WordWrap = WordWrap.Wrap;
            this.gridBand5.Caption = "Dự kiến";
            this.gridBand5.Columns.Add(this.colQuantity);
            this.gridBand5.Columns.Add(this.colMoneyTotal);
            this.gridBand5.Name = "gridBand5";
            this.gridBand5.Width = 0x87;
            this.colQuantity.Caption = "Số lượng";
            this.colQuantity.FieldName = "Quantity";
            this.colQuantity.Name = "colQuantity";
            this.colQuantity.OptionsColumn.AllowEdit = false;
            this.colQuantity.OptionsColumn.ReadOnly = true;
            this.colQuantity.Visible = true;
            this.colQuantity.Width = 60;
            this.colMoneyTotal.Caption = "Chi ph\x00ed thực hiện";
            this.colMoneyTotal.ColumnEdit = this.repCal;
            this.colMoneyTotal.FieldName = "MoneyTotal";
            this.colMoneyTotal.Name = "colMoneyTotal";
            this.colMoneyTotal.Visible = true;
            this.repCal.AutoHeight = false;
            this.repCal.Buttons.AddRange(new EditorButton[] { new EditorButton(ButtonPredefines.Combo) });
            this.repCal.Mask.UseMaskAsDisplayFormat = true;
            this.repCal.Name = "repCal";
            this.gridBand6.AppearanceHeader.Options.UseTextOptions = true;
            this.gridBand6.AppearanceHeader.TextOptions.HAlignment = HorzAlignment.Center;
            this.gridBand6.AppearanceHeader.TextOptions.WordWrap = WordWrap.Wrap;
            this.gridBand6.Caption = "Chi ph\x00ed dự kiến cho 1 NV";
            this.gridBand6.Columns.Add(this.colMoneyOneEmployee);
            this.gridBand6.Columns.Add(this.colMoneyOneCompany);
            this.gridBand6.Columns.Add(this.colMoneyOneTotal);
            this.gridBand6.Name = "gridBand6";
            this.gridBand6.Width = 0xe1;
            this.colMoneyOneEmployee.Caption = "Số tiền NV đ\x00f3ng";
            this.colMoneyOneEmployee.ColumnEdit = this.repCal;
            this.colMoneyOneEmployee.FieldName = "MoneyOneEmployee";
            this.colMoneyOneEmployee.Name = "colMoneyOneEmployee";
            this.colMoneyOneEmployee.Visible = true;
            this.colMoneyOneCompany.Caption = "Số tiền c\x00f4ng ty hổ trợ";
            this.colMoneyOneCompany.ColumnEdit = this.repCal;
            this.colMoneyOneCompany.FieldName = "MoneyOneCompany";
            this.colMoneyOneCompany.Name = "colMoneyOneCompany";
            this.colMoneyOneCompany.Visible = true;
            this.colMoneyOneTotal.Caption = "Tổng tiền";
            this.colMoneyOneTotal.ColumnEdit = this.repCal;
            this.colMoneyOneTotal.FieldName = "MoneyOneTotal";
            this.colMoneyOneTotal.Name = "colMoneyOneTotal";
            this.colMoneyOneTotal.Visible = true;
            this.gridBand7.AppearanceHeader.Options.UseTextOptions = true;
            this.gridBand7.AppearanceHeader.TextOptions.HAlignment = HorzAlignment.Center;
            this.gridBand7.AppearanceHeader.TextOptions.WordWrap = WordWrap.Wrap;
            this.gridBand7.Caption = "Tổng chi ph\x00ed dự kiến";
            this.gridBand7.Columns.Add(this.colMoneyAllEmployee);
            this.gridBand7.Columns.Add(this.colMoneyAllCompany);
            this.gridBand7.Columns.Add(this.colMoneyAllTotal);
            this.gridBand7.Name = "gridBand7";
            this.gridBand7.Width = 0xe1;
            this.colMoneyAllEmployee.Caption = "Số tiền NV đ\x00f3ng";
            this.colMoneyAllEmployee.ColumnEdit = this.repCal;
            this.colMoneyAllEmployee.FieldName = "MoneyAllEmployee";
            this.colMoneyAllEmployee.Name = "colMoneyAllEmployee";
            this.colMoneyAllEmployee.Visible = true;
            this.colMoneyAllCompany.Caption = "Số tiền c\x00f4ng ty hổ trợ";
            this.colMoneyAllCompany.ColumnEdit = this.repCal;
            this.colMoneyAllCompany.FieldName = "MoneyAllCompany";
            this.colMoneyAllCompany.Name = "colMoneyAllCompany";
            this.colMoneyAllCompany.Visible = true;
            this.colMoneyAllTotal.Caption = "Tổng tiền";
            this.colMoneyAllTotal.ColumnEdit = this.repCal;
            this.colMoneyAllTotal.FieldName = "MoneyAllTotal";
            this.colMoneyAllTotal.Name = "colMoneyAllTotal";
            this.colMoneyAllTotal.Visible = true;
            this.gridBand8.AppearanceHeader.Options.UseTextOptions = true;
            this.gridBand8.AppearanceHeader.TextOptions.HAlignment = HorzAlignment.Center;
            this.gridBand8.AppearanceHeader.TextOptions.WordWrap = WordWrap.Wrap;
            this.gridBand8.Caption = "Đối t\x00e1c thực hiện";
            this.gridBand8.Columns.Add(this.colPartnerName);
            this.gridBand8.Columns.Add(this.colPartnerPhone);
            this.gridBand8.Columns.Add(this.colPartnerAddress);
            this.gridBand8.Name = "gridBand8";
            this.gridBand8.Width = 0x152;
            this.colPartnerName.Caption = "T\x00ean đối t\x00e1c";
            this.colPartnerName.FieldName = "PartnerName";
            this.colPartnerName.Name = "colPartnerName";
            this.colPartnerName.Visible = true;
            this.colPartnerName.Width = 0x66;
            this.colPartnerPhone.Caption = "Số điện thoại";
            this.colPartnerPhone.FieldName = "PartnerPhone";
            this.colPartnerPhone.Name = "colPartnerPhone";
            this.colPartnerPhone.Visible = true;
            this.colPartnerPhone.Width = 0x4d;
            this.colPartnerAddress.Caption = "Địa chỉ li\x00ean hệ";
            this.colPartnerAddress.FieldName = "PartnerAddress";
            this.colPartnerAddress.Name = "colPartnerAddress";
            this.colPartnerAddress.Visible = true;
            this.colPartnerAddress.Width = 0x9f;
            this.dm.DockModeVS2005FadeSpeed = 0x3e8;
            this.dm.TopZIndexControls.AddRange(new string[] { "DevExpress.XtraBars.BarDockControl", "DevExpress.XtraBars.StandaloneBarDockControl", "System.Windows.Forms.StatusBar", "DevExpress.XtraBars.Ribbon.RibbonStatusBar", "DevExpress.XtraBars.Ribbon.RibbonControl" });
            this.panelControl1.BorderStyle = BorderStyles.NoBorder;
            this.panelControl1.Controls.Add(this.gcList);
            this.panelControl1.Dock = DockStyle.Fill;
            this.panelControl1.Location = new Point(0, 0x2d);
            this.panelControl1.Name = "panelControl1";
            this.panelControl1.Padding = new Padding(0, 1, 0, 0);
            this.panelControl1.Size = new Size(0x2e8, 0x1d2);
            this.panelControl1.TabIndex = 3;
            base.AutoScaleDimensions = new SizeF(6f, 13f);
            base.AutoScaleMode = AutoScaleMode.Font;
            base.Controls.Add(this.panelControl1);
            base.Name = "xucWelfare";
            base.Size = new Size(0x2e8, 0x1ff);
            base.Controls.SetChildIndex(base.ucToolBar, 0);
            base.Controls.SetChildIndex(this.panelControl1, 0);
            this.gcList.EndInit();
            this.gbList.EndInit();
            this.repCal.EndInit();
            this.dm.EndInit();
            this.panelControl1.EndInit();
            this.panelControl1.ResumeLayout(false);
            base.ResumeLayout(false);
        }

        protected override void Print()
        {
            if (MyRule.IsPrint("bbiWelfare"))
            {
                SYS_LOG.Insert("Danh S\x00e1ch Ph\x00f2ng Ban", "In");
                new xfmReport("Danh S\x00e1ch Ph\x00f2ng Ban").ShowPrintPreview(this.gcList);
                base.Print();
            }
        }

        private void RaiseItemSelectedEventHander(HRM_WELFARE item)
        {
            if (this.ItemSelected != null)
            {
                this.ItemSelected(this, item);
            }
        }

        public override void ReLoad()
        {
            base.SetWaitDialogCaption("Đang nạp dữ liệu...");
            this.gcList.DataSource = new HRM_WELFARE().GetList();
            base.SetWaitDialogCaption("Đang nạp cấu h\x00ecnh...");
            this.gbList.ClearColumnsFilter();
            base.SetWaitDialogCaption("Đ\x00e3 xong...");
            this.DoHide();
        }

        protected override void SetMenu(Common.Class.RowClickEventArgs e)
        {
            object rowCellValue = this.gbList.GetRowCellValue(this.gbList.FocusedRowHandle, "WelfareCode");
            base.DisableMenu(false);
            if (rowCellValue == null)
            {
                base.DisableMenu(true);
            }
            else
            {
                base.SetMenu(e);
            }
        }

        public override void SetSearch(Common.Class.RowClickEventArgs e)
        {
            if (base._search)
            {
                HRM_WELFARE item = new HRM_WELFARE();
                object rowCellValue = this.gbList.GetRowCellValue(base.MRowClickEventArgs.RowIndex, "WelfareCode");
                if (rowCellValue != null)
                {
                    base.SetWaitDialogCaption("Đang kiểm tra dữ liệu....");
                    if (item.Get(rowCellValue.ToString()) != "OK")
                    {
                        this.DoHide();
                        XtraMessageBox.Show("Dữ liệu kh\x00f4ng tồn tại", "Th\x00f4ng B\x00e1o", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                    else
                    {
                        this.DoHide();
                        this.RaiseItemSelectedEventHander(item);
                    }
                }
            }
        }

        private void ucList_ListKeyDown(object sender, KeyEventArgs key)
        {
            if (key.KeyCode == Keys.F2)
            {
                if (this.gbList.RowCount != 0)
                {
                    this.Change();
                }
            }
            else if ((key.KeyCode == Keys.Control) | (key.KeyCode == Keys.E))
            {
                if (this.gbList.RowCount != 0)
                {
                    this.Change();
                }
            }
            else if (key.KeyCode == Keys.Enter)
            {
                if (this.gbList.RowCount != 0)
                {
                    this.Change();
                }
            }
            else if (key.KeyCode == Keys.F5)
            {
                this.ReLoad();
            }
            else if ((key.KeyCode == Keys.Control) | (key.KeyCode == Keys.N))
            {
                this.Add();
            }
            else if ((key.KeyCode == Keys.Control) | (key.KeyCode == Keys.T))
            {
                this.Add();
            }
        }

        public delegate void ItemSelectedEventHander(object sender, HRM_WELFARE item);
    }
}

